M291 S5 J1 L200 F350 R"Nozzle Tightening" P"Set the temperature for the Test"
var temp = input

M568 P0 S{var.temp} R{var.temp} A2
M568 P1 S{var.temp} R{var.temp} A2
M568 P2 S{var.temp} R{var.temp} A2
M568 P3 S{var.temp} R{var.temp} A2

M564 H1 ; Disable movement without homing

if !move.axes[0].homed || !move.axes[1].homed || !move.axes[3].homed
    G28 Y
    G28 X
    G28 U

    if !move.axes[2].homed
    G28 Z

M98 P"0:/sys/led/start_cold.g"

G90
G1 Y0 F18000
G1 X-999 U999 F18000
G1 Y-75 F18000


M116 P0 S5
M116 P1 S5

G4 S30

M98 P"0:/sys/led/start_hot.g"
G1 X-50 U50 Y-150 Z400 F18000
M291 R"Tighten Nozzles" P"Both nozzles are at target temperature. Tighten each nozzle to 1.5Nm" S4 K{"Nozzles Tightened","Cancel"}
if input == 1
    abort "Test cancelled by user"


M568 P0 S0 R0
M568 P1 S0 R0
M568 P2 S0 R0
M568 P3 S0 R0


; Purging Bucket Clearance Height Adjustment
G1 X-190 U190 Y-73
var msg = "<b>IMPORTANT: Brush Positioning</b><br><br>• Brushes ONLY touch nozzle cone<br>• Position at cone/hex block junction<br>• Do NOT touch hex block<br><br>Ready to test?"
M291 R"Adjust Purging Buckets" P{var.msg} S4 K{"Test","Skip","Cancel"}
if input == 1
    M99
elif input == 2
    abort "Test cancelled by user"

M98 P"0:/sys/nozzlewipe.g" T0 C1
M98 P"0:/sys/nozzlewipe.g" T1 C1